package action.querywork;

import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;

import model.Work;

import org.apache.struts2.ServletActionContext;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.Result;

import com.opensymphony.xwork2.ActionSupport;

import service.queryWorkService;

@Namespace("")
@Action(
	value="AdminqueryAllWork",
	results={
			@Result(name="success",location="/WEB-INF/releaseResult.jsp")
	}		
)
public class AdminqueryAllWork extends ActionSupport{
	public String execute() throws Exception{
		ArrayList<Work> WorkList=new ArrayList<Work>();
		queryWorkService qws=new queryWorkService();
		try {
			 WorkList=qws.queryAllWork();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		HttpServletRequest request=ServletActionContext.getRequest();
		request.setAttribute("WorkList", WorkList);
		return  SUCCESS;
	}
	
}
